-module(chop_tests).
-export([]).
-import(chop, [chop/2]).

-include_lib("eunit/include/eunit.hrl").

chop_1_test() ->
    ?assertEqual(-1, chop(3, [])),
    ?assertEqual(-1, chop(3, [1])),
    ?assertEqual(1, chop(1, [1])).

chop_2_test() ->
    ?assertEqual(1, chop(1, [1,3,5])),
    ?assertEqual(2, chop(3, [1,3,5])),
    ?assertEqual(3, chop(5, [1,3,5])),
    ?assertEqual(-1, chop(0, [1,3,5])),
    ?assertEqual(-1, chop(2, [1,3,5])),
    ?assertEqual(-1, chop(4, [1,3,5])),
    ?assertEqual(-1, chop(6, [1,3,5])).

chop_3_test() ->
    ?assertEqual(1, chop(1, [1,3,5,7])),
    ?assertEqual(2, chop(3, [1,3,5,7])),
    ?assertEqual(3, chop(5, [1,3,5,7])),
    ?assertEqual(4, chop(7, [1,3,5,7])),
    ?assertEqual(-1, chop(0, [1,3,5,7])),
    ?assertEqual(-1, chop(2, [1,3,5,7])),
    ?assertEqual(-1, chop(4, [1,3,5,7])),
    ?assertEqual(-1, chop(6, [1,3,5,7])),
    ?assertEqual(-1, chop(8, [1,3,5,7])).
    
